package com.ruoyi.project.api.cat;

import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.project.api.cat.vo.CatVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/cat")
public class CatApiController {

    final CatApiService catApiService;

    @Autowired
    public CatApiController(CatApiService catApiService) {
        this.catApiService = catApiService;
    }

    @GetMapping("/tree")
    public AjaxResult catTree() {
        List<CatVo> tree = this.catApiService.getCatTree();
        return AjaxResult.success(tree);
    }

}
